@extends("admin.layout.common")
@section('content')
    <style>
        header ul li:last-child img {
            width: 30px;
            transform: translateY(0%);
        }
        .bill_box{
            padding:20px;
        }
        .bill_box ul{
            padding-bottom:20px;
        }
        .bill_box ul>li{
            float:left;
            color:#333;
            font-size: 24px;
            padding:0 30px;
            line-height: 60px;
        }
        table{
            width:96%;
        }
        table td,th{
            border:1px solid #ccc;
        }
    </style>
    <!-- 公共结束 -->
    <div class="content">
        <h1 class="h1">财务分账中心</h1>
        <div class="bill_box">
            <ul class="cl">
                <li>
                    分账周期：
                    <span>{{$time}}</span>
                </li>
                <li>
                    分账类型：
                    <span>代理分账</span>
                </li>
                <li>
                    分账金额：
                    <span>{{$sum}}</span>
                </li>
                <li>
                    分账人数：
                    <span>{{$num}}</span>
                </li>
            </ul>
            <table>
                <tr>
                    <th>ID</th>
                    <th>代理</th>
                    <th>作品</th>
                    <th>结算平台</th>
                    <th>结算费用</th>
                    <th>合计收入</th>
                </tr>
                @foreach($accounts as $account)
                    <tr>
                        <td rowspan="{{count($account['excel'])}}">{{$account['id']}}</td>
                        <td rowspan="{{count($account['excel'])}}">{{$account['simple_name']}}</td>
                        @foreach($account['excel'] as $excel)
                            @if($loop->first)
                                <td>{{$excel['title']}}</td>
                                <td>{{$excel['income']['platform']['platform']}}</td>
                                <td>{{$excel['agent_money']}}</td>
                            @endif
                        @endforeach
                        <td rowspan="{{count($account['excel'])}}">{{$account['gross_income']}}</td>
                    </tr>
                    @foreach($account['excel'] as $excel)
                        @if(!$loop->first)
                            <td>{{$excel['title']}}</td>
                            <td>{{$excel['income']['platform']['platform']}}</td>
                            <td>{{$excel['agent_money']}}</td>
                        @endif
                    @endforeach
                @endforeach
            </table>
            {{$accounts->links()}}
        </div>
    </div>
@endsection